<?php
/**
 * 定时向服务器发送broadcast事件信息
 */
require_once './vendor/autoload.php';

set_time_limit(0);
$host = 'localhost';
$port = '7001';
$socket = new \HemiFrame\Lib\WebSocket\WebSocket($host, $port);
$client = $socket->connect();
$data = [
    'event' => 'broadcast'
];
while (true) {
    $socket->sendData($client, json_encode($data));
    echo $client->getId().' broadcast'."\n";
    sleep(1);
}